<template>
  <div class="car">
    <div class="right">
      <ul>
        <li @click="func(i)" v-for="(v,i) in list" :key="i">{{v.title}}</li>
      </ul>
    </div>

    <div class="left">
      <div class="menuList" v-for="(v,i) in list" :key="i">
        <p>
          <b>{{v.title}}</b>
        </p>
        <div v-for="(item,index) in v.son" :key="index" @click="detail(i,index)">
          <img :src="item.img" alt />
          <p>{{item.title}}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState, mapActions } from "vuex";
export default {
  created() {
    this.SETLIST();
  },
  computed: {
    ...mapState(["list"])
  },
  methods: {
    ...mapActions(["SETLIST"]),
    func(i) {
      console.log(i);
    },
    detail(i,index){
      this.$router.push(`/detail/${i}/${index}`)
     
    }
  }
};
</script>

<style scoped>
.car {
  width: 100%;
  height: 100%;
}
.right {
  position: fixed;
  right: 0;
  top: 30px;
  color: #bbb;
}
.right ul li {
  padding: 1px 4px;
  text-align: center;
}
.left {
  width: 100%;
  height: 100%;
}
.menuList img {
  border-radius: 50%;
}
.menuList > p {
  background: #eee;
  width: 100%;
  padding: 5px 10px;
}
.menuList > div {
  display: flex;
  align-items: center;
  padding: 10px;
}
.menuList > div p{
  margin-left: 15px;
}
</style>